{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "afa491bb-d240-46dd-9060-beecff1c5a5b",
   "metadata": {},
   "source": [
    "# Scatter with Color and Size Encoding\n",
    "\n",
    "A scatter plot that encodes four variables: x-position, y-position, color, and size."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "d6bee5f3-e8db-44a2-9481-6bbdff554f68",
   "metadata": {},
   "outputs": [],
   "source": [
    "import hvplot.pandas  # noqa\n",
    "\n",
    "df = hvplot.sampledata.earthquakes('pandas')\n",
    "\n",
    "df.hvplot.scatter(\n",
    "    x='lon',\n",
    "    y='lat',\n",
    "    color='mag',\n",
    "    size='depth',\n",
    "    cmap='plasma_r',\n",
    "    alpha=0.7,\n",
    "    clabel='Magnitude',\n",
    "    title='Earthquakes by magnitude and depth (Bokeh)'\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "8418bf62-792b-442d-93d2-b4f25d54cf08",
   "metadata": {},
   "outputs": [],
   "source": [
    "import hvplot.pandas  # noqa\n",
    "hvplot.extension('matplotlib')\n",
    "\n",
    "df = hvplot.sampledata.earthquakes('pandas')\n",
    "\n",
    "df.hvplot.scatter(\n",
    "    x='lon',\n",
    "    y='lat',\n",
    "    color='mag',\n",
    "    size='depth',\n",
    "    cmap='plasma_r',\n",
    "    alpha=0.7,\n",
    "    clabel='Magnitude',\n",
    "    title='Earthquakes by magnitude and depth (Matplotlib)'\n",
    ")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "4d174f54-f797-46bc-880d-9d7c8f4c335a",
   "metadata": {},
   "source": [
    ":::{seealso}\n",
    "- [Scatter reference documentation](../../ref/api/manual/hvplot.hvPlot.scatter.ipynb).\n",
    ":::"
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python",
   "pygments_lexer": "ipython3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
